<?php
// 应用公共文件

function dataLog($data,$tag="",$source="",$type="Log",$version="1.0.0"){
    dataSend("127.0.0.1","/log/save1.0.0.php",array(
        'version' => $version,
        "data" => $data,
        "type" => $type,
        "host" => $source,
        "time" => date("Y-m-d H:i:s"),
        "tag" => $tag ));
}

function dataSend($host,$path, $para,$scheam="http") {
    $fp = fsockopen($host,80);
    
    $url = "$scheam://".$host.$path;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $para);//用post方法传送参数
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($ch);
    curl_close($ch);
    return $response;
}